// import router from '../index'
import { router } from "@/router"

import { ElMessage } from "element-plus"

import Pace from "pace-js"
import store from "@/store"
import { userStore } from "@/store/modules/user"

export const initAgent = () => {
  if (Object.keys(store.webConfig.resourceMain).length === 0) {
    // const webConfig = webConfig()
    // webConfig.FlushWebConfigMain();
    store.webConfig.FlushWebConfigMain()

    /*if (store.userStore.token) {
      if (store.userStore.user.username == null || store.userStore.user.username === "") {
        store.dispatch("GetInfo").then((res) => {
          store.dispatch("ConnectUserSocket").then(r => console.log(r))
          Pace.stop()
        }).catch(err => {
          ElMessage.error(err)
        })
      }
    }*/
    store.userSocket.ConnectUserSocket()

  }
}

